<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>JSON</title>
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/jquery.min.js"></script>
</head>
<body>
<script type="text/javascript">
    var users = [{
        id: 1,
        name: '如花'
    }, {
        id: 2,
        name: '十月'
    }];

    $.ajax({
        url: '${pageContext.request.contextPath}/json',
        type: 'post',
        dataType: 'json',
        data: JSON.stringify(users),
        contentType: "application/json",
        success: function (data) {
            document.write("查看控制台");
            console.log(data);
        },
        error: function (xhr, status, err) {
            console.log(status, err);
        }
    })
</script>
</body>
</html>
